﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Newtonsoft.Json;

public partial class Rep_QuarterRep : System.Web.UI.Page
{
    BLL.BLLRep br = new BLL.BLLRep();
    public static string pName = "";
    public static string jpg = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        string name = HttpUtility.UrlDecode(Request.QueryString["name"]);
        if (name != null & name != "")
        {
            pName = name;
            jpg = name;
        }

        string param = Request["param"];
        if (param != "")
        {
            if (param == "query")
            {
                string time = Request["time"] + "-01-01 0:00:00";
                string jd = Request["jd"];
                QueryTableList(pName, "季报", time, Convert.ToInt32(jd));
            }
        }
        else
        {
            QueryTableList(pName, "季报", DateTime.Now.ToString("yyyy-01-01 0:00:00"), 1);
        }
    }
    protected void QueryTableList(string pName, string type, string time, int jd)
    {
        string strApp = br.RetTableByMonth(pName, type, Convert.ToDateTime(time), jd);
        int count = 1;
        if (pName == "电能质量技术监督报表")
            count = 6;
        object obj = new
        {
            title = pName,
            count = count,
            tableInfo = strApp
        };
        string result = JavaScriptConvert.SerializeObject(obj);
        Response.Write(result);
        Response.End();
    }
}